package com.ellricky.tv.adapter

import android.content.Context
import androidx.appcompat.widget.AppCompatImageView
import com.andr.common.ui.adapter.BaseRecyclerAdapter
import com.andr.common.ui.adapter.SmartViewHolder
import com.ellricky.baselib.entity.IdNameEntity
import com.ellricky.baselib.entity.new.CourseType
import com.ellricky.tv.R
import kotlinx.android.synthetic.main.tv_base_layout_header.*


class TvCourseTypeAdapter(val context: Context) : BaseRecyclerAdapter<CourseType>(R.layout.tv_item_course_type) {

    override fun onBindViewHolder(holder: SmartViewHolder?, entity: CourseType?, position: Int) {

        val ivCourseBg = holder?.itemView?.findViewById<AppCompatImageView>(R.id.ivCourseBg)

        when (entity?.course_name) {
            "美学基础课" -> ivCourseBg?.setBackgroundResource(R.drawable.tv_icon_course_1)
            "艺术创造" -> ivCourseBg?.setBackgroundResource(R.drawable.tv_icon_course_3)
            "体验课" -> ivCourseBg?.setBackgroundResource(R.drawable.tv_icon_course_5)
            "艺术史" -> ivCourseBg?.setBackgroundResource(R.drawable.tv_icon_course_2)
        }
    }
}